package chatGUI;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * @author Michael & Pierre
 */
/**
 * Window Listener to perform disconnection before window closing
 */
public class WindowAdapterForClosing extends WindowAdapter {

	/**
	 * To keep track of the calling platform-specific GUI
	 */
	JavaGUI chatGUILoopback;
	
	/**
	 * Constructor to memorize the calling platform-specific GUI's address
	 * @param gui
	 */
	public WindowAdapterForClosing(JavaGUI gui) {
		this.chatGUILoopback = gui;
	}
	
	/**
	 * Demands to the calling platform-specific GUI to perform its closing method
	 * @param e
	 */
	public void windowClosing(WindowEvent e) {
		chatGUILoopback.closeWindow();
	}
	
}
